package com.bobi.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.bobi.utils.StringUtils;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;
import java.util.Date;
import java.io.Serializable;

/**
 * 降价活动商品(BobiCutpriceActivityGoods)实体类
 *
 * @author makejava
 * @since 2023-07-02 16:30:09
 */
@Data
@TableName("bobi_cutprice_activity_goods")
@AllArgsConstructor
@NoArgsConstructor
public class CutpriceActivityGoods extends BaseEntity {
    private static final long serialVersionUID = -29611562304204159L;

    /**
     * 结算金额
     */
    private Double settlementPrice;
    /**
     * 优惠价格
     */
    private Double discountPrice;
    /**
     * 商品原价
     */
    private Double originalPrice;
    /**
     * 商品外键
     */
    private Integer goodsId;
    /**
     * 冗余字段，商品名称
     */
    private String goodsName;
    /**
     * 冗余字段，商品图片
     */
    private String goodsImg;

    public QueryWrapper<CutpriceActivityGoods> initWrapper(CutpriceActivityGoods cutpriceActivityGoods) {
        if(cutpriceActivityGoods.getId() != null || cutpriceActivityGoods.getGoodsName() != null) {
            QueryWrapper<CutpriceActivityGoods> queryWrapper = new QueryWrapper<>();
            queryWrapper.eq(StringUtils.isNotBlank(cutpriceActivityGoods.getId()), "id", cutpriceActivityGoods.getId());
            queryWrapper.eq(StringUtils.isNotBlank(cutpriceActivityGoods.getGoodsName()), "goods_name" ,cutpriceActivityGoods.getGoodsName());
            return queryWrapper;
        }
        return null;
    }

}

